package com.smartleanx.module.hrm.framework.config;

import com.smartleanx.framework.common.enums.WebFilterOrderEnum;
import com.smartleanx.framework.web.config.WebProperties;
import com.smartleanx.module.hrm.framework.web.EmployeeContextWebFilter;
import com.smartleanx.module.hrm.service.employee.EmployeeService;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * HRM web 配置
 *
 * @author tengcj
 * @since 2024/5/23
 */
@Configuration(proxyBeanMethods = false)
public class HrmWebFilterConfig {

    @Bean
    public FilterRegistrationBean<EmployeeContextWebFilter> employeeWebFilter(WebProperties webProperties, EmployeeService employeeService) {
        FilterRegistrationBean<EmployeeContextWebFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new EmployeeContextWebFilter(webProperties, employeeService));
        registrationBean.setOrder(WebFilterOrderEnum.DEMO_FILTER);
        return registrationBean;
    }

}
